package com.cloudcc.mobile.im;

import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

import com.cloudcc.mobile.im.ui.ChatActivity;

public class UIControl {

	/**
	 * 打开聊天页面
	 * 
	 * @param context
	 *            上下文
	 * @param sendUserId
	 *            发送消息 的用胡 is
	 * @param sendUserNick
	 *            发送消息的用户 nick
	 * @param receiveUserId
	 *            接收消息的用户 id
	 * @param receiveUserNick
	 *            接收消息的用户nick
	 */
	public static void openChatUI(Context context, String receiveUserId,String receiveUserNick, boolean isGroup) {
		if (!IMHelper.getInstance().isLoggedIn()) {
			Toast.makeText(context, "聊天服务器未连接成功...", 0).show();
			return;
		}
		Intent intent = new Intent();
		intent.setClass(context, ChatActivity.class);
		intent.putExtra(ChatActivity.KEY_USERID, receiveUserId);
		intent.putExtra(ChatActivity.KEY_USERNAME, receiveUserNick);
		if (isGroup) {
			intent.putExtra(Constant.EXTRA_CHAT_TYPE, Constant.CHATTYPE_GROUP);
		}
		context.startActivity(intent);
	}
}
